#ifndef __TREE_H__
#define __TREE_H__
#include "Common.h"
#include "Object.h"
#include "TreeNode.h"

#include <memory>

NAME_SPACE_BEGIN
template < typename T >
class Tree : public Object
{
public:
	Tree() { m_root = nullptr; }

	virtual bool insert(TreeNode<T>* node) = 0;
	virtual bool insert(const T& value, TreeNode<T>* parent) = 0;
	virtual std::shared_ptr< Tree<T> > remove(const T& value) = 0;
	virtual  std::shared_ptr< Tree<T> > remove(TreeNode<T>* node) = 0;
	virtual TreeNode<T>* find(const T& value) const = 0;
	virtual TreeNode<T>* find(TreeNode<T>* node) const = 0;

	virtual TreeNode<T>* root() const = 0;
	virtual int degree() const = 0;
	virtual int count() const = 0;
	virtual int height() const = 0;

	virtual void clear() = 0;
	virtual bool begin() = 0;

	virtual bool end() = 0;
	virtual bool next() = 0;

	virtual T current() = 0;

protected:
	Tree(const Tree<T>&);
	Tree<T>& operator = (const Tree<T>&);

	TreeNode<T>* m_root;
};

NAME_SPACE_END

#endif
